package com.mifengs.mall.adapter;

import android.content.Context;
import android.graphics.Paint;
import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.mifengs.mall.R;
import com.mifengs.mall.entity.AdvertBean;
import com.mifengs.mall.util.ImageLoadUtil;

import java.util.List;

/**
 * Created by lihaoqi on 2017/10/31.
 */

public class TwoThreeItemAdapter extends BaseQuickAdapter<AdvertBean,BaseViewHolder> {

    private Context mContext;

    public TwoThreeItemAdapter(@LayoutRes int layoutResId, @Nullable List<AdvertBean> data, Context mContext) {
        super(layoutResId, data);
        this.mContext = mContext;
    }

    @Override
    protected void convert(BaseViewHolder helper, AdvertBean item) {
        ImageView imageView = helper.getView(R.id.pro_img);
        imageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
        TextView originalPrice = helper.getView(R.id.original_price_text);
        originalPrice.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG);
        originalPrice.getPaint().setAntiAlias(true);
        RelativeLayout rlLayout = helper.getView(R.id.des_rl_layout);
        rlLayout.getBackground().setAlpha(100);
        ImageLoadUtil.displayImage(mContext,item.getImg(),imageView);
        helper.setText(R.id.des_text,item.getText()).setText(R.id.normal_price_text,"¥"+item.getPrice()).setText(R.id.original_price_text,"¥"+item.getCashwtf());
    }

}